Repository navigation
Feat(publish): Prepare forks in a separate job - #204
Merged
ModeSevenIndustrialSolutions merged 3 commits intoNov 22, 2026
Merged
ModeSevenIndustrialSolutions merged 3 commits into
ModeSevenIndustrialSolutions merged 3 commits into
Conversation
Creating or renaming a fork needs Administration: write, and a GitHub App holds its permissions on every installation at once. The fork creation mint therefore leaves the App able to administer every repository in the target organisation, not just the fork pools. These expected-fail tests describe the replacement: a "Prepare forks" job, beside the author matrix, that creates and renames forks with a machine account's token, which reaches that one step alone. No App mint may request Administration, the publish job loses its fork creation mint, and the publisher reads the fork it needs, reporting a missing one by naming the forks job instead of making it. The caller forwards the token from a FORK_POOL_TOKEN repository secret. Co-authored-by: Claude <noreply@anthropic.com> Signed-off-by: Matthew Watkins <mwatkins@linuxfoundation.org>
ModeSevenIndustrialSolutions
requested review from
a team
and
a balanced review from Copilot
November 18, 2026 11:35
The publish job created a missing fork with an App token holding Administration: write. A GitHub App holds its permissions on every installation at once, so the code monkey App could administer every repository in the target organisation, although only the fork pools needed it, and only to create or rename a fork. A new "Prepare forks" job does that instead, beside the author matrix. It holds one credential, a fork_pool_token secret: a classic token of a machine account that belongs to the fork organisations alone. The job refuses any token not scoped to public_repo alone, proves every matrix entry against the committed fork mapping, and finds, renames or creates each target's fork, trying every target before failing. It requests every missing fork before it waits for any, against one shared deadline, and writes each fork's summary row as its outcome is final, so a large first run fits its timeout and keeps its report. The publisher now only requires the fork. It loses the fork creation mint, so no App mint requests Administration and the App can drop the permission. A fork still missing at publish time gets no fork token, and the push fails that one issue with a reason naming the forks job. fork_pool.py takes over the creation code and its tests; the cron caller forwards the token from a FORK_POOL_TOKEN repository secret. Co-authored-by: Claude <noreply@anthropic.com> Signed-off-by: Matthew Watkins <mwatkins@linuxfoundation.org>
The design described the publisher creating and renaming forks with an App token holding Administration: write. The forks job does that now, with a machine account's classic token, and the App holds no Administration grant. Section 4.3 gives the forks job step 1 and explains why the grant cannot sit on the App; section 8 drops the creation mint; section 10.1 loses the Administration rows; a new section 10.6 describes the fork pool credential and its reach. The failure modes gain an absent or too-broad token, and the README and the overview show the new job and the optional fork_pool_token secret. Co-authored-by: Claude <noreply@anthropic.com> Signed-off-by: Matthew Watkins <mwatkins@linuxfoundation.org>
ModeSevenIndustrialSolutions
force-pushed
the
feat/prepare-forks-job
branch
from
November 18, 2026 20:31
7c45244 to
b5d9240
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
The credential migration requires operator verification of fork-pool-only machine-account access and post-rollout removal of App Administration permissions, which token scope checks cannot establish.
No open issues 🎉
1 resolved since last review
Review effort: Balanced
This was referenced Nov 22, 2026
ModeSevenIndustrialSolutions
merged commit Nov 22, 2026
81ecac6
into
lfreleng-actions:main
34 checks passed
This was referenced Nov 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Why
The publish job created a missing fork with an App token holding Administration: write. A GitHub App holds its permissions on every installation at once, so the code monkey App could administer every repository in
lfreleng-actions, although only the fork pools needed it, and only to create or rename a fork (POST /repos/{target}/forks,PATCH /repos/{fork}). An audit of every write inscripts/and.github/workflows/found no other use of the grant.What changes
Test(publish): Expect forks made outside the App: expected-fail contract and unit tests for the new shape.Feat(publish): Prepare forks in a separate jobforks) runs afterselect, beside the author matrix, on livebranchesandpull-requestsruns only. It holdscontents: read, checks out the pinned trusted assets and nothing else, and runsscripts/fork_pool.py prepare.fork_pool_tokensecret, reaches that one step.fork_pool.pyrefuses any token that is not a classic token scoped topublic_repoalone (read fromX-OAuth-Scopes), proves each matrix entry againstconfig/fork-orgs.json, then finds, renames or creates each target's fork. It requests every missing fork before waiting for any, against one shared one-minute deadline, so a large first run waits about as long as one fork; it writes each summary row as that fork's outcome is final, tries every target, and fails the job if any fork is not ready. The job's timeout is 30 minutes. Without the secret it warns and does nothing.forksbut still runs ifforksfails or is skipped. Thefork-create-tokenmint is gone, so no App mint requests Administration. The publisher'srequire_forkonly reads the fork. When the fork is missing, no fork token is minted and the push fails that one issue with a reason naming the forks job.branch_refs.py/test_fork_publish.pytofork_pool.py/test_fork_pool.py.secrets.FORK_POOL_TOKEN.Docs: Describe the forks job and pool token: updatesDESIGN.md§4, §4.3, §8, §9.1, §10.1, §13 and §14, adds §10.6 on the fork pool credential, and updatesREADME.mdanddocs/index.md.Rollout
lfreleng-bot-forks,lfreleng-bot-forks-onap,lfreleng-bot-forks-oranscandlfreleng-bot-forks-opendaylightand of nothing else, with permission to create repositories there.public_repoonly) as theFORK_POOL_TOKENrepository secret here.Until step 2, existing forks keep working. Every active public
lfreleng-actionsrepository already has a fork inlfreleng-bot-forks.Validation
uv run python -B -m unittest discover -s tests: 1618 tests OK (1587 before), at the head and at theFeatcommit.prek run --files <changed files>: all hooks pass, includingaislop,basedpyright,mypy,actionlintandwrite-good.scripts/agents/aislop-gate.sh upstream/main: clean, 16 files.zizmor --persona auditor .github/workflows/in online mode, both v1.30.1 locally and the version inconfig/zizmor-version.txt: no findings.